Skip to content

Comments

feat: task-aware model routing via x-char-task header#4145

Merged
yujonglee merged 2 commits intomainfrom
feat/task-aware-model-routing
Feb 22, 2026
Merged

feat: task-aware model routing via x-char-task header#4145
yujonglee merged 2 commits intomainfrom
feat/task-aware-model-routing

Conversation

@yujonglee
Copy link
Contributor

Summary

  • Introduces a CharTask enum (chat / enhance / title) that the frontend sends as an x-char-task HTTP header on every LLM request
  • Refactors LlmProxyConfig model lists into a ModelResolver trait with a StaticModelResolver implementation, so different tasks can map to different model pools
  • Updates all useLanguageModel() call-sites to pass the appropriate task, and adds createTracedFetch(task) to inject the header transparently

Test plan

  • Enhance flow uses enhance task models
  • Chat flow uses chat task models
  • Title generation uses title task models
  • Requests with tools (tool-calling) still fall back to the tool-calling model pool when no task-specific pool is configured
  • cargo test -p llm-proxy passes (unit tests for StaticModelResolver)

Made with Cursor

Introduces a `CharTask` enum (chat/enhance/title) that flows from the
frontend through a custom HTTP header to the LLM proxy, enabling
task-specific model selection instead of a single model list for all
requests. Refactors model resolution behind a `ModelResolver` trait
with a `StaticModelResolver` implementation.

Co-authored-by: Cursor <cursoragent@cursor.com>
@netlify
Copy link

netlify bot commented Feb 22, 2026

Deploy Preview for hyprnote canceled.

Name Link
🔨 Latest commit c5dee2b
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/699a849c0b2f77000818ec8c

@netlify
Copy link

netlify bot commented Feb 22, 2026

Deploy Preview for hyprnote-storybook canceled.

Name Link
🔨 Latest commit c5dee2b
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/699a849c3e2147000802380b

@yujonglee yujonglee merged commit 78225ce into main Feb 22, 2026
19 of 20 checks passed
@yujonglee yujonglee deleted the feat/task-aware-model-routing branch February 22, 2026 04:23
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.


Self { models }
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enhance task silently falls back to default models

Low Severity

StaticModelResolver::default() configures dedicated model pools for Chat and Title tasks but not Enhance, even though the frontend sends x-char-task: enhance on all enhance requests. The resolve method finds no "enhance" key and silently falls back to MODEL_KEY_DEFAULT, making the enhance task header a no-op for model selection. The test for this path is named unknown_task_falls_back_to_default, reinforcing that Enhance is treated the same as an unrecognized task despite being a first-class CharTask variant.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant